import fetch from 'utils/fetch';

//商户查询
//export function merchantAll(merchantFormData) {
//return fetch({
//	url:  '/api/admin/merchant/find',
//headers: {'Content-type': 'application/json;charset=UTF-8'},
//method: 'post',
//data:merchantFormData
//});
//}
//
////商户分页
//export function merchantPage(merchantFormData) {
//return fetch({
//headers: {'Content-type': 'application/json;charset=UTF-8'},  	
//	url:  '/api/admin/query/find',
//method: 'post',
//params:merchantFormData
//});
//}
//


// 查询所属代理商 ---------- V2.4接口 -----------
// 根据角色传入相应参数
// 如果是代理商传(除去0零级代理商): distributorId 
// 如果是0零级代理商或者机构或者财务传: companyId  
// 如果是业务员: salesmanId
// 如果是公司: firmId
export function searchDistributor(searchData) {
  return fetch({
  url:  '/api/admin/distributor/getRoleFindDistributor',
  headers: {'Content-type': 'application/json;charset=UTF-8'},
  method: 'post',
  data:searchData
  });
}


//新增商户     remarks  审核类型  （0：进件  1：修改）---------- V2.1接口 -----------
export function addMerchant(merchantFormData) {
  return fetch({
	url:  '/api/admin/viceMerchant/create',
  headers: {'Content-type': 'application/json;charset=UTF-8'},
  method: 'post',
  data:merchantFormData
  });
}

//商户查询
export function findMerchant(merchantFormData) {
  return fetch({
	url:  '/api/admin/merchant/findMerchant',
  headers: {'Content-type': 'application/json;charset=UTF-8'},
  method: 'post',
  data:merchantFormData
  });
}

//商户详情
export function merchantDetail(merchantId) {
  return fetch({
	url:  '/api/admin/merchant/merchantDetail/' + merchantId,
  method: 'get',
  });
}


//根据商户id查询店铺
export function merchantShop(merchantId) {
return fetch({
	url:  '/api/admin/shop/getMerchantIdShop/'+ merchantId,
	headers: {'Content-type': 'application/json;charset=UTF-8'},
	method: 'get',
	});
}

//根据商户id查询店铺 （后面换的）
export function merchantShopTwo(merchantId) {
  return fetch({
    url:  '/api/admin/shop/getShopListByMerchantId/'+ merchantId,
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    method: 'get',
    });
  }


//新增店铺       remarks 0 新增  ， 1 修改
export function addShopAjax(shopFormData) {
  return fetch({
	url:  '/api/merc/viceShop/create',
  headers: {'Content-type': 'application/json;charset=UTF-8'},
  method: 'post',
  data:shopFormData
  });
}
//查询代理商
export function queryAgent(data) {
  return fetch({
    url: 'api/admin/distributor/selectAllDistributor',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}

//商户停用启用
export function mercUpdateIsEnabled(merchantId,enabled) {
  return fetch({
	url:  '/api/admin/merchant/updateIsEnabled/' + merchantId + '/' + enabled,
  method: 'get',
  });
}

//查询行业
export function queryIndustry(locale){
  return fetch({
	url:  '/api/share/industry/findIndustry/' + locale,
  method: 'get',
  });
}

//删除商户
export function delMer(merId,userId) {
  return fetch({
	url:  '/api/admin/merchant/deleteMerchant/ '+ merId +'/'+ userId,
  headers: {'Content-type': 'application/json;charset=UTF-8'},
  method: 'get',
  });
}

//删除店铺
export function delShop(shopId) {
  return fetch({
	url:  '/api/admin/shop/deleteShop/' + shopId,
  headers: {'Content-type': 'application/json;charset=UTF-8'},
  method: 'get',
  });
}


//商户重新进件
export function reauditMer(data) {
  return fetch({
	url:  '/api/admin/viceMerchant/reaudit',
  headers: {'Content-type': 'application/json;charset=UTF-8'},
  method: 'post',
  data
  });
}

//店铺重新进件
export function reauditShop(data) {
  return fetch({
    url:  '/api/merc/viceShop/reauditShop',
  headers: {'Content-type': 'application/json;charset=UTF-8'},
  method: 'post',
  data
  });
}

//检验商户名称是否重复
export function checkMerchantName(data) {
  return fetch({
    url:  '/api/admin/viceMerchant/checkMerchantName',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    method: 'post',
    data
  });
}

//检验商户手机号或者邮箱是否重复
export function checkPhone(data) {
  return fetch({
    url:  '/api/auth/user/checkPhone',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    method: 'post',
    data
  });
}

//检验子商户号是否重复
export function checkSubMerchantNo(data) {
  return fetch({
    url:  '/api/admin/viceMerchant/checkSubMerchantNo',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    method: 'post',
    data
  })
}

//检验香港钱包商户号是否重复
export function checkHkNo(data) {
  return fetch({
    url:  '/api/admin/viceMerchant/checkHkNo',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    method: 'post',
    data
  })
}

//检验支付宝 HK 商户号是否重复
export function checkAlipayHkNo(data) {
  return fetch({
    url:  '/api/admin/viceMerchant/checkAlipayHkNo',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    method: 'post',
    data
  })
}

//检验支付宝商户号是否重复
export function checkAlipayNo(data) {
  return fetch({
    url:  '/api/admin/viceMerchant/checkAlipayNo',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    method: 'post',
    data
  })
}

//检验店铺名称是否重复
export function checkShopName(shopName,merchantId,shopId) {
  return fetch({
    url: '/api/merc/viceShop/checkShopName',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    method: 'post',
    data:{
      shopName,
      merchantId,
      shopId
    }
  });
}

//澳洲商户进件业务员列表
export function AU_BD_list() {
  return fetch({
    url:  '/api/admin/salesman/getAustraliaDefaultSalesman',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    method: 'get',
  });
}

//澳洲商户进件州
export function AU_State_list( companyId,language  ) {
  return fetch({
    url:  '/api/share/region/findRegionList/'  + companyId + '/' + language,
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    method: 'get',
  });
}

//检查银联商户号是否重复接口
export function checkUnionPayNo( data ) {
    return fetch({
      url:  '/api/admin/viceMerchant/checkUnionPayNo',
      headers: {'Content-type': 'application/json;charset=UTF-8'},
      method: 'post',
      data
    });
  }

  //检查AugsPay用户名是否重复接口
export function checkAugsUserName( data ) {
    return fetch({
      url:  '/api/admin/viceMerchant/checkAugsUserName',
      headers: {'Content-type': 'application/json;charset=UTF-8'},
      method: 'post',
      data
    });
  }